package com.qingneng.web;

import java.util.List;

import org.apache.log4j.Logger;

import com.opensymphony.xwork2.Action;
import com.qingneng.service.sdk.IProjectInfoService;
import com.qingneng.vo.ProjectInfo;
import com.tbfs.common.BaseAction;
import com.tbfs.security.CurrentUser;

public class LoadProjectInfoAction extends BaseAction {

	private static final Logger logger = Logger
			.getLogger(LoadProjectInfoAction.class);

	private IProjectInfoService projectInfoService = null;

	public LoadProjectInfoAction(IProjectInfoService projectInfoService) {
		this.projectInfoService = projectInfoService;
	}
	
	private ProjectInfo projectInfo;

	public ProjectInfo getProjectInfo() {
		return projectInfo;
	}

	public void setProjectInfo(ProjectInfo projectInfo) {
		this.projectInfo = projectInfo;
	}

	public LoadProjectInfoAction() {
	}

	private List rows = null;

	private Integer total;

	private String volidateAccessDataAuth;

	public List getRows() {
		return rows;
	}

	public void setRows(List rows) {
		this.rows = rows;
	}

	public Integer getTotal() {
		return total;
	}

	public void setTotal(Integer total) {
		this.total = total;
	}
	

	public String execute() {
		try {
			if(projectInfo==null){
				projectInfo = new ProjectInfo();	
			}
			
			//分页
			this.processPaginationBean();
			volidateAccessDataAuth = this.volidateAccessDataAuth();
			//所有数据
			if("0".equals(volidateAccessDataAuth)){
				
			}
			//公司数据数据
			if("1".equals(volidateAccessDataAuth)){
				projectInfo.setCompany_code(CurrentUser.getCurrentCompanyCode());
			}
			//个人数据
			if("2".equals(volidateAccessDataAuth)){
				projectInfo.setCreatePerson(CurrentUser.getUser().getUseraccount()); 
			}
				
			rows = projectInfoService.getProjectInfo(projectInfo);
			total = projectInfoService.getProjectInfoTotalCount(projectInfo);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Action.SUCCESS;
	}
	
	
	

}
